package com.tempjob.admin.vo;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author hui
 * @Date 2024/10/25 12:15
 **/
@Data
@ApiModel
@NoArgsConstructor
public class GeoVO {

    private String type;
    private List<Features> features;

    @Data
    public static class Features {
        private String type;
        private Properties properties;
        private Geometry geometry;

        public Features(String id, String name,List<List<Double>> coordinates) {
            this.properties =new Properties(id, name);
            this.geometry = new Geometry(coordinates);
            this.type = "Feature";
        }
    }

    @Data
    public static class Geometry {
        private List<List<List<List<Double>>>> coordinates;
        private String type;
        public Geometry(List<List<Double>> coordinates) {
            this.coordinates = List.of(List.of(coordinates));
            this.type = "MultiPolygon";
        }
    }

    @Data
    @AllArgsConstructor
    public static class Properties {
        private String id;
        private String name;
    }

    public GeoVO( List<Features> features) {
        this.type = "FeatureCollection";
        this.features = features;
    }
}
